<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login</title>
<script language="javascript" type="text/javascript">
function loginValidation()
{
var custId = document.loginform.custid;
var passWrd = document.loginform.pass;

if(validCustID(custId)){
if(validPassWrd(passWrd)){
	document.forms[0].submit();
	return true;

}
}
return false;
}

function validCustID(custId)
{
var custLen = custId.value.length;
var noFormat = /^\d+$/;
if(custLen == 0)
{
alert('Customer ID must not be Empty'); 
return false;
}
if(custLen < 8)
{
alert('Customer ID Invalid \n Must be 8 digit long'); 
return false;
}

if(custId.value.match(noFormat)){
	return true;
	} 
	else
	{
	alert('Entered Customer ID is Invalid \n Please enter your 8 digit Customer ID');
	return false;	
	}
}

function validPassWrd(passWrd)
{
var passLen = passWrd.value.length;
if(passLen == 0)
{
alert('Password must not be Empty'); 
return false;
}else
{
return true;
}
}

</script>
</head>
<body>
<table width=100% bordercolor="#C6D4E1" bgcolor="#C6D4E1">
<tr><th scope="col"><div align="center"><h1 align="center"><font face="Times New Roman">Tros - Online Banking System </font></h1></div></th></tr>
</table>
&nbsp;
<fieldset>
<legend><b>Login</b></legend>
<form name="loginform" action="LoginValidation" onSubmit="return loginValidation();" method="post">
<table width=50% align=center cellpadding=5 cellspacing=0 bgcolor="#D5FFD5">
<tr><td>&nbsp;</td><tr> 
<tr>
<td><div align="right">Customer ID:</div></td>
<td bgcolor="#D5FFD5"><input type="text" name="custid" value="" maxlength=8/></td>
</tr>
<tr>
<td><div align="right">Password :</div></td>
<td bgcolor="#D5FFD5"><input type="password" name="pass" value="" maxlength=12/></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor="#D5FFD5"><button type="submit"><u>L</u>ogin</button>&nbsp;<button type="reset"><u>R</u>eset</button></td> 
</tr>
<tr><td>&nbsp;</td></tr>
<tr><td colspan="1"><div align="right"><a href="signup.jsp">Sign Up</a></div></td><td><div align="center"><a href="forgotPassword.jsp">Forgot Credentials</a></div></td></tr>
<tr><td>&nbsp;</td></tr>
</table>
</form>
</fieldset>
</body>
</html>